<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html 
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	lang="en">
	
  
	<ui:decorate template="/WEB-INF/facelets/conteudoSis.xhtml">
		<ui:define name="conteudo">
			<div class="row-fluid">
				<div class="span12" style="height: 70px;">
				</div>
			</div>	
			
			<div class="row-fluid">
				<div class="span2">
				</div>
				<div class="span8">
					<h:panelGroup rendered="#{AlunoMB.modoListar}">
						
							<h:messages id="messages" globalOnly="true"
								style="border: 1px solid #999999;background-color:#ffffee;padding:6px;font-weight:bold"
								errorStyle="color:#ff0000;font-weight:bold" layout="table" />
						
							<h:form styleClass="well">
								<p:commandButton action="#{AlunoMB.criar}" value="Novo &raquo;" ajax="false" styleClass="btn btn-primary"/>
								<p></p>
						
								<p:dataTable value="#{AlunoMB.lista}" var="obj" selectionMode="single"
									selection="#{AlunoMB.entidade}" paginator="true" rows="10"
									rowKey="#{obj.id}" widgetVar="tabela">
						
						
									<p:column>
										<f:facet name="header">
											<h:outputText value="Nome" />
										</f:facet>
										<h:outputText value="#{obj.nome}" />
									</p:column>
						
									<p:column>
										<f:facet name="header">
											<h:outputText value="E-mail" />
										</f:facet>
										<h:outputText value="#{obj.email}" />
									</p:column>
						
									<p:column>
										<f:facet name="header">
											<h:outputText value="Vencimento" />
										</f:facet>
										<div align="center">
											<h:outputText value="#{obj.diaVencimento}" />
										</div>
									</p:column>
						
									<p:column>
										<f:facet name="header">
											<h:outputText value="Telefone 1" />
										</f:facet>
										<h:outputText value="#{obj.telefone1}" />
									</p:column>
									
									<p:column>
										<f:facet name="header">
											<h:outputText value="Telefone 2" />
										</f:facet>
										<h:outputText value="#{obj.telefone2}" />
									</p:column>
						
									<p:column>
										<f:facet name="header">
											<h:outputText value="Editar" />
										</f:facet>
										<p:commandButton value="Editar" action="#{AlunoMB.editar(obj)}" ajax="false"/>
									</p:column>
								</p:dataTable>
							</h:form>
						</h:panelGroup>
					
						<h:panelGroup rendered="#{AlunoMB.modoEditar}">
							<h:form  styleClass="well span12">
								<legend>Cadastro de Alunos</legend>
								<p:messages id="mensagens"></p:messages>
								<div class="row-fluid">
									
									<div class="span6">
										<div class="control-group">
											<h:outputLabel value="Nome:" for="nome" styleClass="control-label" />
											<p:inputText id="nome" value="#{AlunoMB.entidade.nome}" maxlength="200" />
										</div>
										
										<div class="control-group">
											<h:outputLabel value="Telefone 1:" for="telefone1" styleClass="control-label" />
											<p:inputText id="telefone1" value="#{AlunoMB.entidade.telefone1}" maxlength="20" />
										</div>
										
										<div class="control-group">
											<h:outputLabel value="Data Nascimento:" for="nascimento" styleClass="control-label" />
											<p:inputMask id="nascimento" mask="99/99/9999"  value="#{AlunoMB.entidade.dataNascimento}" maxlength="10" >
												<f:convertDateTime locale="pt_BR"></f:convertDateTime>
											</p:inputMask>
										</div>
										
										<div class="control-group">
											<h:outputLabel value="Dia vencimento:" for="venc" styleClass="control-label" />
											<p:inputMask id="venc" mask="99"  value="#{AlunoMB.entidade.diaVencimento}"/>
										</div>
									</div>
									
									<div class="span6">
										<div class="control-group">
											<h:outputLabel value="E-mail:" for="email" styleClass="control-label" />
											<p:inputText id="email" value="#{AlunoMB.entidade.email}" maxlength="100" />
										</div>
										
										
										<div class="control-group">
											<h:outputLabel value="Telefone 2:" for="telefone2" styleClass="control-label" />
											<p:inputText id="telefone2" value="#{AlunoMB.entidade.telefone2}" maxlength="20" />
										</div>
										
										<div class="control-group">
											<h:outputLabel value="Sócio:" for="socio" styleClass="control-label" />
											<p:selectBooleanCheckbox id="socio" value="#{AlunoMB.entidade.socio}"/>
												
										</div>
									</div>
								</div>	
									
								<div class="row-fluid">
									<div class="span6">
										<div class="control-group">
											<p:commandButton value="Gravar" action="#{AlunoMB.gravar}" ajax="false" styleClass="btn btn-success"/>
					
											<p:commandButton action="#{AlunoMB.voltar}" value="Voltar" ajax="false" immediate="true" styleClass="btn btn-warning"/>
										</div>
									</div>		
										
									<div class="span6">
										<div class="control-group">		
											<p:commandButton value="Excluir" action="#{AlunoMB.excluir}"
												rendered="#{AlunoMB.exibirExcluir}" onclick="confirmation.show()"
												ajax="false" type="button" styleClass="btn btn-danger"/>
										</div>
												
										<p:confirmDialog id="confirmDialog"
											message="Confimar a exclusão do registro?" header="Confirmação!"
											severity="alert" widgetVar="confirmation">
							
											<p:commandButton id="confirm" value="Sim"
												oncomplete="confirmation.hide()" action="#{AlunoMB.excluir}"
												ajax="false" />
									
											<p:commandButton id="decline" value="Não"
												onclick="confirmation.hide()" type="button" />
										</p:confirmDialog>
											
									</div>
								</div>
							</h:form>
						</h:panelGroup>
					</div>
				</div>
			</ui:define>
	</ui:decorate>
</html>